package com.company;

import com.company.observer.*;

/**
 * 观察者模式测试代码
 */
public class TestForObserver {

    public static void main(String[] args) {
        //汽油
        OilPrice gasoline = new GasolinePrice();

        //小车车主
        Owner carOwner = new CarOwner();
        //货车车主
        Owner truckOwner = new TruckOwner();

        //添加观察者(小车车主和货车车主)
        gasoline.add(carOwner);
        gasoline.add(truckOwner);

        //油价上涨
        gasoline.change(true);

        System.out.println("============================");

        //油价下铁
        gasoline.change(false);

    }
}
